package com.baymax.test.scene

import android.content.ComponentName
import android.content.Intent
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup

class JumpScene :BaseScene() {
    override fun onCreateView(p0: LayoutInflater, p1: ViewGroup, p2: Bundle?): View {
        return p1.newScrollContainer {
            val icntv = Intent()
            icntv.setComponent(ComponentName("tv.icntv.ott" ,"tv.icntv.ott.icntv"))
            addButton("筛选页") {
                icntv.putExtra(
                    "actionUrl",
                    "http://sns.is.ysten.com/CNTV/index.html?action=markupsearch"
                )
                icntv.start()
            }

            addButton("足迹") {
                icntv.putExtra(
                    "actionUrl",
                    "http://sns.is.ysten.com/CNTV/behavior/index.html?type=footprint"
                )
                icntv.start()
            }

            addButton("二级屏") {
                icntv.putExtra("actionUrl" ,"panelSwitch?action=switch&panelType=subscr\n" +
                        "een&screenId=1063086379505811456&desktopId=948811052244533248")
                icntv.start()
            }

            addButton("home") {
                icntv.putExtra("actionUrl" ,"panelSwitch?action=switch&panelType=subscreen&screenId=1687563122421792768&desktopId=1207839395994927104&backType=home")
                icntv.start()
            }

        }


    }
    fun Intent.start(){
        kotlin.runCatching {  requireActivity().startActivity(this) }.onFailure(::print)
    }
}
